#include "widget.h"
#include "ui_widget.h"
#include <QDebug>
#include <QPushButton>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    //在构造函数中打印窗口的尺寸位置
    QRect rec1=this->geometry();
    QRect rec2=this->frameGeometry();
    qDebug()<<rec1;
    qDebug()<<rec2;

    QPushButton* button=new QPushButton(this);
    button->setText("按钮");
    connect(button,&QPushButton::clicked,this,&Widget::handleClicked);
}



Widget::~Widget()
{
    delete ui;
}

void Widget::handleClicked()
{
    //在这里再打印窗口的尺寸位置
    QRect rec1=this->geometry();
    QRect rec2=this->frameGeometry();
    qDebug()<<rec1;
    qDebug()<<rec2;

}

